package com.daily.daily_push.config;

import com.daily.daily_push.utils.K8sConstantsUtil;
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.util.ClientBuilder;
import io.kubernetes.client.util.credentials.AccessTokenAuthentication;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Slf4j
//@Component
public class K8sTokenConfig {

//    @Resource
//    private VirtualProperties virtualProperties;

//    @Bean
    public ApiClient k8sClient(){
        ApiClient client = new ClientBuilder().
                setBasePath(K8sConstantsUtil.K8S_API).setVerifyingSsl(false).
                    setAuthentication(new AccessTokenAuthentication(K8sConstantsUtil.K8S_TOKEN)).build();
        Configuration.setDefaultApiClient(client);
        return client;
    }

/*    virtual:
    docker-url: tcp://192.168.2.207:8088
    k8s-url: https://192.168.2.207:6443
    k8s-token: xx
    server-url: 192.168.2.207
    server-name: root
    server-pwd: 123456
    tar-path: /opt/tar/
    harbor-url: core.harbor.domain
    harbor-uname: admin
    harbor-pwd: Harbor12345*/


}
